Miscellaneous

int _text_read(int fd, char &sstarf#star;buf, int bytes); int _text_write(int fd, char &sstarf#star;buf, int bytes); The same as read() and write(), except the CR character is discarded on input and inserted on output.


#include stdlib.h>

void &sstarf#star;bsearch(const void &sstarf#star;key, const void &sstarf#star;base, size_t num, size_t size, int (&sstarf#star;cmp)()); Binary search a field starting at base with num elements each size size for key.

div_t div(int num, int denom); ldiv_t ldiv(long num, long denom); Perform division and return both quotient and remainder.

char &sstarf#star;getenv(const char &sstarf#star;name); Get the contents of the environment variable name.

void qsort(void &sstarf#star;base, size_t num, size_t size, int (&sstarf#star;cmp)()); Quick sort an array of num elements with size size starting at base.

int rand(); Return a pseudo random number in the range from 0 to RAND_MAX.

void srand(unsigned int seed); Use seed to initialize the pseudo-random number generator.


#include keycodes.h>

int console_input_status(int handle); Check, if character is available from standart CON:. (This is the same as Cconis)

unsigned int console_read_byte(int handle); Raw input from standart CON: without echoing to screen. (This is the same as Crawcin)

void console_write_byte(int handle, int character); Write character c to handle handle. (This is a Fwrite with count 1)


#include support.h>

void dos2unx(const char &sstarf#star;t_fname, char &sstarf#star;u_fname); Convert filenames from TOS format to U&sstarf#star;ix format.

time_t dostime(time_t); Convert U&sstarf#star;ix time to TOS time and date (lower word = time, upper word = date).

char &sstarf#star;findfile(char &sstarf#star;fname, char &sstarf#star;path, char &sstarf#star;&sstarf#star;ext); Locate the file fname along the paths in path with ext containing possible extensions.

void fnmapfunc(fnmapfunc_t u2dos, fnmapfunc_t dos2u); Set mapping functions for the unx2dos and dos2unx routines.

int symlink(char &sstarf#star;old , char &sstarf#star;new); Make a new symbolic link from new to old. Env. UNIXMODE determines behavior.

int readlink(char &sstarf#star;fname , char &sstarf#star;buf, int siz); Read the link for fname into buf.

time_t unixtime(unsigned tostime, unsigned tosdate); Convert a TOS time/date pair into a U&sstarf#star;ix time.

void unx2dos(const char &sstarf#star;u_fname, char &sstarf#star;t_fname); Convert filenames from U&sstarf#star;ix format to TOS format.

void _set_unixmode(char &sstarf#star;mode); Set features of the extended file system.

void _uniquefy(char &sstarf#star;dos); Make an unigue TOS filename for the extended file system.


#include sysvars.h>

long get_sysvar(void &sstarf#star;var); Get the contents of the system variable var.

void set_sysvar_to_long(void &sstarf#star;var, long val); Set the system variable var to the long value val.